package cn.com.taiji.core;

import com.jfinal.plugin.activerecord.dialect.*;
import com.jfinal.plugin.activerecord.generator.MetaBuilder;

import javax.sql.DataSource;

/**
 * 
 * @author dongwei dongweia@mail.taiji.com.cn
 *
 */
/**
 * 获取数据库链接; 初始化代码生成基本信息;
 */
public class CodeGenHelpler extends DbInit {

	/**
	 * 获取数据源:指定配置文件db.setting中分组;
	 *
	 * @return
	 */
	public static DataSource getDatasource() {
		return getDataSourceDruid();
	}

	public static MetaBuilder createMetaBuilder(String[] tableNames, String prefix) {

		CommonMetaBuilder metaBuilder = new CommonMetaBuilder(getDatasource(), tableNames, prefix);
		metaBuilder.setDialect(new OracleDialect());
		return metaBuilder;
	}
}
